import { useRef, useState, Suspense,lazy } from 'react'
import LdMainContainer from '../../components/LdMainContainer'
const OperationLog = lazy(()=>import('./components/OperationLog'))
const CarrierLog = lazy(()=>import('./components/CarrierLog'))
const CloneLog = lazy(()=>import('./components/CloneLog'))
const Daily = () => {
    const defaultMenu = useRef([
        { label: "操作日志", icon: "operateLog", hidden: false, count: 0, key: 'OperationLog' },
        { label: "打印日志", icon: "carrierLog", hidden: false, key: 'CarrierLog', count: 0, },
        { label: "刻录日志", icon: "record", hidden: false, key: 'CloneLog', count: 0, },
    ])
    const [defaultKey, setDefaultKey] = useState<string>('OperationLog')
    const handleChange = (data: any) => {
        if (defaultKey === data.key) return
        setDefaultKey(data.key)
    }
    return (
        <>
            <LdMainContainer menus={defaultMenu.current} defaultKey={defaultKey} change={handleChange}>
                <Suspense>
                    {
                        defaultKey === 'OperationLog' ? <OperationLog /> : defaultKey === 'CarrierLog' ? <CarrierLog /> : <CloneLog />
                    }
                </Suspense>
            </LdMainContainer>
        </>
    )
}
export default Daily